//package com.maoshi.shop.seckill.comment.listener;
//
//import com.maoshi.shop.bean.enums.OrderType;
//import com.maoshi.shop.bean.event.PaySuccessOrderEvent;
//import com.maoshi.shop.bean.order.PaySuccessOrderOrder;
//import lombok.AllArgsConstructor;
//import org.springframework.context.event.EventListener;
//import org.springframework.core.annotation.Order;
//import org.springframework.stereotype.Component;
//
//import java.util.List;
//import java.util.Objects;
//
///**
// * 秒杀成功回调
// * @author LGH
// */
//@Component("seckillPaySuccessListener")
//@AllArgsConstructor
//public class PaySuccessOrderListener {
//
//    private SeckillOrderMapper seckillOrderMapper;
//
//    /**
//     * 更新秒杀状态
//     */
//    @EventListener(PaySuccessOrderEvent.class)
//    @Order(PaySuccessOrderOrder.SECKILL)
//    public void seckillPaySuccessListener(PaySuccessOrderEvent event) {
//        List<com.maoshi.shop.bean.model.Order> orders = event.getOrders();
//
//        for (com.maoshi.shop.bean.model.Order order : orders) {
//            if (!Objects.equals(order.getOrderType(), OrderType.SECKILL.value())) {
//                return;
//            }
//            // 更新秒杀状态
//            seckillOrderMapper.updateStateByOrderNumber(order.getOrderNumber(), 1);
//
//        }
//
//    }
//}
